package com.liy.supercloud.ssoserver.runner;

import com.liy.supercloud.ssoserver.service.RolePermissionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PermissionInitializationRunner implements CommandLineRunner {
    private static Logger log = LoggerFactory.getLogger(PermissionInitializationRunner.class);

    @Autowired
    private RolePermissionService rolePermissionService;

    public void run(String... args) throws Exception {
        try {
            log.info("Permission sync start.");
            this.rolePermissionService.synSharePermissionToRedis("all");
            this.rolePermissionService.synRolePermissionToRedis();
            log.info("Permission sync finish.");
        } catch (Exception var3) {
            log.info("Permission sync exception: " + var3.getMessage(), var3);
        }

    }
}
